import 'package:get/get.dart';
import 'home_controller.dart';

class UploadHistoryController extends GetxController {
  // 从 HomeController 获取响应式列表的引用
  late final RxList<Map<String, dynamic>> uploadHistory;

  UploadHistoryController() {
    // 确保 HomeController 已经被创建
    if (Get.isRegistered<HomeController>()) {
      final homeController = Get.find<HomeController>();
      uploadHistory = homeController.uploadHistory;
    } else {
      // 异常处理
      uploadHistory = <Map<String, dynamic>>[].obs;
    }
  }

  void clearHistory() {
    if (Get.isRegistered<HomeController>()) {
      Get.find<HomeController>().uploadHistory.clear();
    }
  }
}
